
function wsPeiZhi() {
	let yuMing;
	
	if (import.meta.env.DEV) yuMing = 'localhost';
	if (import.meta.env.PROD) yuMing = 'www.haoqixinsyt.cn';

	let ws = new WebSocket(`ws://${yuMing}:8080`);
	
	ws.addEventListener('open', function(event) {

	});

	ws.onclose = function(evt) {};

	let huoQuJueSeHao = new Promise((resolve, reject) => {
		
		ws.addEventListener('message', function(evt) {

			let jieGuo = JSON.parse(evt.data);
			
			resolve(jieGuo.jueSeHao);
			
		})
		
	})
	
	return {
		ws,
		huoQuJueSeHao
	}
}

export default wsPeiZhi;